package com.rwdesign.springboot.Waimai.service.Impl;

import com.github.pagehelper.PageHelper;
import com.rwdesign.springboot.Waimai.dao.UserMapper;
import com.rwdesign.springboot.Waimai.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author rystart
 * @create 2022-01-29 12:39
 */
@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public Integer selectUserIdByPhonenumber(String phoneNumber) {
        return userMapper.selectUserIdByPhonenumber(phoneNumber);
    }

    @Override
    public Integer selectIdByPhonenumberAndpwd(String userTelephone, String userPassword) {
        return userMapper.selectIdByPhonenumberAndpwd(userTelephone, userPassword);
    }

    @Override
    public String selectUsernameById(Integer userId) {
        return userMapper.selectUsernameById(userId);
    }

    @Override
    public Integer updateTokenById(String Token, Integer userId) {
        return userMapper.updateTokenById(Token, userId);
    }

    @Override
    public Integer insertUser(Integer userId, String userName, String userPassword, String userTelephone, String userPicture, String isAdmin, String isShoper, String sessionId, Integer shopId) {
        return userMapper.insertUser(userId, userName, userPassword, userTelephone, userPicture, isAdmin, isShoper, sessionId, shopId);
    }

    @Override
    public Integer updateTokenByToken(String token) {
        return userMapper.updateTokenByToken(token);
    }

    @Override
    public Integer selectIdByToken(String userToken) {
        return userMapper.selectIdByToken(userToken);
    }

    /**
     * @return
     * @Author chendanping
     * @Description //TODO 查询是否为商户
     * @Date 20:18 2022/3/7
     * @Param
     **/
    @Override
    public String selectIsShoperByUserId(Integer userId) {
        return userMapper.selectIsShoperByUserId(userId);
    }

    @Override
    public Integer updateShopIdByUserId(Integer shopId,Integer userId) {
        return userMapper.updateShopIdByUserId(shopId,userId);
    }

    @Override
    public Integer selectShopIdByUserId(Integer userId) {
        return userMapper.selectShopIdByUserId(userId);
    }

}
